<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>lib.scripting.Keyboard</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lib.scripting-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;lib ::
        <a href="lib.scripting-module.html">Module&nbsp;scripting</a> ::
        Class&nbsp;Keyboard
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="lib.scripting.Keyboard-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Keyboard</h1><p class="nomargin-top"><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard">source&nbsp;code</a></span></p>
<p>Provides access to the keyboard for event generation.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__init__"></a><span class="summary-sig-name">__init__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">mediator</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lib.scripting.Keyboard-class.html#send_keys" class="summary-sig-name">send_keys</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">keyString</span>)</span><br />
      Send a sequence of keys via keyboard events</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.send_keys">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lib.scripting.Keyboard-class.html#send_key" class="summary-sig-name">send_key</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">repeat</span>=<span class="summary-sig-default">1</span>)</span><br />
      Send a keyboard event</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.send_key">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lib.scripting.Keyboard-class.html#press_key" class="summary-sig-name">press_key</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>)</span><br />
      Send a key down event</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.press_key">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lib.scripting.Keyboard-class.html#release_key" class="summary-sig-name">release_key</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>)</span><br />
      Send a key up event</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.release_key">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lib.scripting.Keyboard-class.html#fake_keypress" class="summary-sig-name">fake_keypress</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">repeat</span>=<span class="summary-sig-default">1</span>)</span><br />
      Fake a keypress</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.fake_keypress">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lib.scripting.Keyboard-class.html#wait_for_keypress" class="summary-sig-name">wait_for_keypress</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">modifiers</span>=<span class="summary-sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="summary-sig-arg">timeOut</span>=<span class="summary-sig-default">10.0</span>)</span><br />
      Wait for a keypress or key combination</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.wait_for_keypress">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="send_keys"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">send_keys</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">keyString</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.send_keys">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Send a sequence of keys via keyboard events</p>
  <p>Usage: <code>keyboard.send_keys(keyString)</code></p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>keyString</code></strong> - string of keys (including special keys) to send</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="send_key"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">send_key</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>,
        <span class="sig-arg">repeat</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.send_key">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Send a keyboard event</p>
  <p>Usage: <code>keyboard.send_key(key, repeat=1)</code></p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>key</code></strong> - the key to be sent (e.g. &quot;s&quot; or 
          &quot;&lt;enter&gt;&quot;)</li>
        <li><strong class="pname"><code>repeat</code></strong> - number of times to repeat the key event</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="press_key"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">press_key</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.press_key">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Send a key down event</p>
  <p>Usage: <code>keyboard.press_key(key)</code></p>
  <p>The key will be treated as down until a matching release_key() is 
  sent.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>key</code></strong> - the key to be pressed (e.g. &quot;s&quot; or 
          &quot;&lt;enter&gt;&quot;)</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="release_key"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">release_key</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.release_key">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Send a key up event</p>
  <p>Usage: <code>keyboard.release_key(key)</code></p>
  <p>If the specified key was not made down using press_key(), the event 
  will be ignored.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>key</code></strong> - the key to be released (e.g. &quot;s&quot; or 
          &quot;&lt;enter&gt;&quot;)</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="fake_keypress"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fake_keypress</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>,
        <span class="sig-arg">repeat</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.fake_keypress">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Fake a keypress</p>
  <p>Usage: <code>keyboard.fake_keypress(key, repeat=1)</code></p>
  <p>Uses XTest to 'fake' a keypress. This is useful to send keypresses to 
  some applications which won't respond to keyboard.send_key()</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>key</code></strong> - the key to be sent (e.g. &quot;s&quot; or 
          &quot;&lt;enter&gt;&quot;)</li>
        <li><strong class="pname"><code>repeat</code></strong> - number of times to repeat the key event</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="wait_for_keypress"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">wait_for_keypress</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>,
        <span class="sig-arg">modifiers</span>=<span class="sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="sig-arg">timeOut</span>=<span class="sig-default">10.0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lib.scripting-pysrc.html#Keyboard.wait_for_keypress">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Wait for a keypress or key combination</p>
  <p>Usage: <code>keyboard.wait_for_keypress(self, key, modifiers=[], 
  timeOut=10.0)</code></p>
  <p>Note: this function cannot be used to wait for modifier keys on their 
  own</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>key</code></strong> - the key to wait for</li>
        <li><strong class="pname"><code>modifiers</code></strong> - list of modifiers that should be pressed with the key</li>
        <li><strong class="pname"><code>timeOut</code></strong> - maximum time, in seconds, to wait for the keypress to occur</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lib.scripting-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Fri Apr 20 20:26:25 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
